﻿using System;
using System.Collections.Generic;

namespace YJKStatisticTable.AreaTable.TableTools
{
	public class CombinationOfAttributes
	{
		public string CategoryName
		{
			get
			{
				return this.m_CategoryName;
			}
		}

		public List<string> AttributesName
		{
			get
			{
				return this.m_AttributesName;
			}
		}

		public List<string> Delimiter
		{
			get
			{
				return this.m_Delimiter;
			}
		}

		public CombinationOfAttributes()
		{
		}

		public CombinationOfAttributes(CombinationOfAttributes comb)
		{
			this.m_CategoryName = comb.m_CategoryName;
			this.m_AttributesName.Clear();
			this.m_AttributesName.AddRange(comb.m_AttributesName);
			this.m_Delimiter.Clear();
			this.m_Delimiter.AddRange(comb.m_Delimiter);
		}

		public CombinationOfAttributes(string categoryName, List<string> attributesName, List<string> delimiter)
		{
			this.m_CategoryName = categoryName;
			this.m_AttributesName.Clear();
			this.m_AttributesName.AddRange(attributesName);
			this.m_Delimiter.Clear();
			this.m_Delimiter.AddRange(delimiter);
		}

		public bool SetAttributes2ndDelimiter(List<string> Attributes, List<string> delimiter)
		{
			this.m_AttributesName.Clear();
			this.m_AttributesName.AddRange(Attributes);
			if (delimiter.Count == this.m_AttributesName.Count - 1)
			{
				this.m_Delimiter.Clear();
				this.m_Delimiter.AddRange(delimiter);
				this.m_Delimiter.Add(" ");
				return true;
			}
			if (delimiter.Count == this.m_AttributesName.Count)
			{
				this.m_Delimiter.Clear();
				this.m_Delimiter.AddRange(delimiter);
				return true;
			}
			return false;
		}

		private string m_CategoryName = "";

		private List<string> m_AttributesName = new List<string>();

		private List<string> m_Delimiter = new List<string>();
	}
}
